iptables + squid + dhcp - compartilhando conexão[ resolve nome, mas nao navega]

1. iptables + squid + dhcp - compartilhando conexão[ resolve nome, mas nao navega]

João Teixeira Junior
juniorjipa

(usa Debian)

Enviado em 18/03/2009 - 12:49h

Aew pessoal sou novo na comunidade, estou configurando um server proxy/iptables/dhcp mas estou com problemas, os host pinga, resolve nomes pelo ping, mas não navega.

poderia dar uma olhada nas minhas conf.

##### INTERFACES

auto eth0
iface eth0 inet static
address 192.168.2.1
netmask 255.255.255.0

auto eth1
iface eth1 inet static
address 201.88.xxx.xxx
netmask 255.255.255.xxx
gateway 201.88.xxx.xxx
dns-nameservers 201.10.128.2 201.10.1.2

#### DHCP

interfaces="eth0";
ddns-update-style none;

default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;

# A slightly different configuration for an internal subnet.
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.50 192.168.2.150;
option domain-name-servers 192.168.2.1;
option domain-name "clabin.com.br";
option routers 192.168.2.1;
option broadcast-address 192.162.2.255;
default-lease-time 7200;
max-lease-time 14400;
}

#### resolv.conf

nameserver 201.10.1.2
nameserver 201.10.128.2

#### squid.conf


# Inicio do arquivo squid.conf
http_port 3128 transparent
hierarchy_stoplist cgi-bin ?

acl QUERY urlpath_regex cgi-bin?
no_cache deny QUERY

#dns_nameservers localhost

cache_mem 32 MB
cache_dir ufs /var/spool/squid 60000 100 256

cache_access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/store.log


#auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/passwd
#auth_param basic children 3
#auth_param basic realm Servidor de Internet Mikitos
#auth_param basic credentialsttl 2 hours

refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320

acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443 563
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 563 # https, snews
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http

acl CONNECT method CONNECT

acl MINHA_REDE src 192.168.2.0/24

#acl USUARIOS proxy_auth REQUIRED
acl BLOQUEADO url_regex -i "/etc/squid/bloqueado"
acl PALAVRA urlpath_regex -i "/etc/squid/palavra"
#acl LIBERADO url_regex -i "/etc/squid/liberado"
#acl FILTRO url_regex -i "/etc/squid/filtro"
acl MALWARE url_regex -i "/etc/squid/malware"
acl DOWNLOADS urlpath_regex -i "/etc/squid/downloads"
#acl LIVRE time MTWHFA 12:30-13:00
#acl LIMITADOS arp "/etc/squid/limitados"

#acl ADMIN arp "/etc/squid/admin" # pelo mac
acl ADMIN src "/etc/squid/admin" # pelo ip


http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports

#http_access allow USUARIOS ADMIN MINHA_REDE
#http_access allow USUARIOS LIVRE MINHA_REDE
#http_access allow USUARIOS LIBERADO MINHA_REDE
#http_access allow USUARIOS !BLOQUEADO !PALAVRA MINHA_REDE

#http_access allow ADMIN MINHA_REDE
#http_access allow LIVRE MINHA_REDE
#http_access allow LIBERADO MINHA_REDE
#http_access allow LIMITADOS FILTRO MINHA_REDE
http_access allow !MALWARE !BLOQUEADO !PALAVRA MINHA_REDE

http_access deny all
http_reply_access allow all
icp_access allow all
visible_hostname labin.com.br
error_directory /usr/share/squid/errors/Portuguese
coredump_dir /var/spool/squid
# Fim do arquivo squid.conf


#### Iptables


iptables -F
iptables -t nat -F

modprobe ip_tables
modprobe iptable_nat
modprobe ip_nat_ftp
modprobe ip_conntrack_ftp
modprobe iptable_filter
modprobe ipt_MASQUERADE

### ativar nat
echo 1 > /proc/sys/net/ipv4/ip_forward

### Mascarar saida pelo Nat
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

### uso pelo porxy transparente
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 1024: -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp --syn -s 127.0.0.1/8 -j ACCEPT
iptables -A INPUT -s 192.168.2.0/24 -j ACCEPT

iptables -L -n










  






Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts